<?php
/**
 * Created by PhpStorm.
 * User: jim
 * Date: 2017-01-05
 * Time: 11:11
 */

namespace App\Http\Controllers\home;


use App\Org\wxpay\WXTool;
use Illuminate\Http\Request;

class GetopenidController
{
    public static function getOpenid(Request $request)
    {
        // 获取微信重定向返回的code
        $code = $request->input('code', '');
        if($code != '') {
            //获取code码，以获取openid
            $openid = WXTool::getOpenid($code);
            // 将openid保存到session
            $request->session()->put('openid', $openid);
        }

    }

}